package calao.client;

import com.google.gwt.user.client.rpc.IsSerializable;

public class SessionInfo 
implements IsSerializable 
{
	long guid;
	String alias;
	String path;
	String[] permissions;
	String userName;
	
	Preferences preferences;
	
	public SessionInfo() { }
	
	public SessionInfo(long guid, String alias, String path) 			 
	{
		this.guid = guid;
		this.alias = alias;
		this.path = path;
	}
	
	public String getUserAlias()
	{
		return alias;
	}

	public Preferences getPreferences() {
		return preferences;
	}

	public void setPreferences(Preferences preferences) {
		this.preferences = preferences;
	}

	public long getGlobalUserId() {
		return guid;
	}

	public String getPath() {
		return path;
	}
	
	public String[] getPermissions() {
		return permissions;
	}

	public void setPermissions(String[] permissions) {
		this.permissions = permissions;
	}
	
	public boolean hasPermission(String permission) {
		for (int i=0; i<permissions.length; i++) {
			if (permissions[i].equals(permission)) return true;
		}
		return false;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}
			
}
